#!/bin/bash

# 源文件路径
LOCK_DIR="../../src/locks"

# 优化所有锁实现
for file in $LOCK_DIR/*.c; do
    echo "Analyzing and optimizing $file..."
    
    # 分析当前实现
    echo "Current implementation analysis:"
    vsyncer info "$file"
    
    # 优化实现
    echo "Optimizing implementation..."
    vsyncer optimize -A -1 "$file"
    
    # 验证优化结果
    echo "Verifying optimization..."
    vsyncer verify "$file"
    
    echo "----------------------------------------"
done

# 运行性能测试
echo "Running performance benchmarks..."
cd ../../
make benchmark 